(1) Field of the Invention
The present invention relates to a moving picture coding apparatus that codes moving picture data.
(2) Description of the Related Art
A single digital content, such as a movie, conventionally includes plural chapters. Such a chapter is, to be specific, a stream in which coded moving picture data and coded audio data are multiplexed.
Accordingly, when generating each stream included in a single digital content, it is necessary to control coding processing for generating the stream so that moving pictures are reproduced seamlessly without a break between streams.
Here, changes in data occupancy of a buffer in a decoding apparatus can be simulated using, for example, a virtual buffer called a Video Buffering Verifier (VBV) buffer assumed to exist in an coding apparatus that codes moving picture data.
Further, coding is controlled according to the result of the buffer simulation so as to prevent the buffer in the decoding apparatus from overflowing and underflowing.
FIG. 1 is a pattern diagram illustrating an example of changes in virtual buffer occupancy for two streams which are not connected seamlessly.
In the example illustrated in FIG. 1, each picture of a preceding stream 1101 is extracted from the virtual buffer at certain intervals. Storage of a following stream 1102 into the virtual buffer starts after a last picture B13 of the preceding stream 1101 has been decoded. It is to be noted that the above-described certain interval is an inverse number of a frame rate for each of the streams, 1/60 seconds, for example.
In this case, a break occurs between a decoded image of a picture B13 positioned last in the preceding stream 1101 and a decoded image of a picture I2 positioned first in the following stream 1102, as illustrated in the diagram.
FIG. 2 is a pattern diagram illustrating an example of changes in virtual buffer occupancy for two streams which are connected seamlessly.
As illustrated in FIG. 2, seamless reproduction is made possible by advancing a decode-starting time for the following stream, since a break between the decoded image of the picture B13 and the decoded image of the picture I2 is eliminated.
As described above, when the coding apparatus generates a following stream so as to be reproduced seamlessly after a preceding stream, it is necessary to take into account virtual buffer occupancy at the end of the preceding stream 1101.
This is because the following stream 1102 starts to be stored into the virtual buffer, with the virtual buffer occupancy not being zero. The following stream 1102 starts to be stored having the virtual buffer occupancy at the end of the preceding stream 1101 as a starting point.
As illustrated in FIG. 2, S0 is assumed to be the virtual buffer occupancy at the end of the preceding stream 1101. In this case, the following stream 1102 starts to be stored at a time t1, and the virtual buffer occupancy starts to increase from the S0. Subsequently, the picture B13 is extracted from the virtual buffer at a time t3, so that the virtual buffer occupancy becomes S1.
The S1 can be obtained based on the following: S0 as a storage starting point; a storage period obtained by subtracting the time t1 from the time t3; an increasing angle θ for a storage amount; and an amount of coded data of the picture B13. It is to be noted that the increasing angle θ is a value determined by a bit rate of the following stream 1102.
Subsequently, the picture I2 is extracted from the virtual buffer at a time t4. At this time, an amount of coded data of the picture I2 needs to be an amount not causing an underflow in the virtual buffer.
In view of the foregoing, the coding apparatus, when generating the picture I2, determines the amount of coded data of the picture I2 according to an initial value S10 of the virtual buffer occupancy for the following stream 1102.
It is to be noted that the initial value of the virtual buffer occupancy for the following stream 1102 is, as illustrated in FIG. 2, the virtual buffer occupancy at a time (t4) when image stream data included in the following stream 1102 is extracted from the virtual buffer for the first time. That is, in FIG. 2, S10.
More specifically, the initial value S10 can be obtained based on the following: the storage amount S1 previously obtained at the time t3, the storage period obtained by subtracting the time t3 from the time t4; and the increasing angle θ.
The coding apparatus subtracts a predetermined margin amount, as needed, from the initial value S10 obtained in such a manner, and determines the amount of coded data of the picture I2 so as not to exceed a value obtained by the subtraction. Further, the coding apparatus codes moving picture data corresponding to the picture I2 so that the amount of coded data of the moving picture data becomes the determined amount of coded data.
Here, each value of the time t3, the time t4, and θ is a predetermined value. Accordingly, the coding apparatus only need to obtain the time t1 and the S0 for the determination of the initial value S10 of the virtual buffer occupancy.
FIG. 3 is a functional block diagram illustrating an example of functional configuration of a conventional moving picture coding apparatus.
The moving picture coding apparatus 200 as illustrated in FIG. 3 includes: an audio coding unit 201 that generates an audio stream from an inputted signal; an image coding unit 202 that generates an image stream from an inputted signal; and a multiplexing unit 203 that multiplexes the audio stream with the image stream.
Further, the moving picture coding apparatus 200 holds, as virtual buffer information 204, information indicating a storage amount of a virtual buffer, which has been outputted from the image coding unit 202.
The multiplexing unit 203 notifies the image coding unit 202 of the virtual buffer occupancy S0 at the end of the preceding stream 1101, and of the time t1 that is the starting time of the image stream included in the following stream 1102.
The starting time t1 can be obtained, for example, in the case where the following stream 1102 includes an audio stream which precedes an image stream as illustrated in FIG. 2, by adding a time corresponding to an amount of coded data of the audio stream to the time t0 that is the time when the last bit (pad shown in FIG. 2) is stored in the virtual buffer.
In another example, the image coding unit 202 includes information of a predetermined value corresponding to the starting time t1, and use the predetermined value as the starting time t1 for buffer simulation without obtaining the starting time t1 from the multiplexing unit 203.
The image coding unit 202 performs buffer simulation using the starting time t1 and the virtual buffer occupancy S0, and determines the initial value S10 of the virtual buffer occupancy for the following stream 1102, before generating an image stream to be included in the following stream 1102. Further, the image coding unit 202 controls coding processing according to the initial value.
A technique which relates to a seamless stream connection as described above is disclosed, for example, by Patent Reference 1: Japanese Patent No. 3675464.
Here, the multiplexing for the following stream 1102 cannot start prior to the end of the preceding stream 1101. More specifically, the multiplexing for the following stream 1102 can start only after the multiplexing for the preceding stream 1101 has been completed.
For the above reason, a time for multiplexing is practically required between the end of outputting the preceding stream 1101 and the start of outputting the following stream 1102.
Further in some cases, an end portion of the preceding stream 1101 or a start portion of the following stream 1102 may include specific information having control information for ending processing and starting processing for a multiplexed stream.
FIG. 4 is a pattern diagram illustrating differences in a starting time for an image stream included in the following stream 1102.
In (i) of FIG. 4, specific information is not included in either the preceding stream 1101 or the following stream 1102. Further in (ii) of FIG. 4, the preceding stream 1101 includes specific information 1203 and the following stream 1102 includes specific information 1204.
With this, the starting time for the image stream included in the following stream 1102 delays by D0 as compared to that in (i).
Further, (iii) of FIG. 4 includes a time required for multiplexing between the preceding stream 1101 and the following stream 1102. With this, the starting time for the image stream included in the following stream 1102 delays by D0 as compared to that in (i).
As described above, the starting time for the image stream included in the following stream 1102 delays by the time required for multiplexing and by an amount of specific information added to the multiplexed stream.
However, the above-described conventional technique made no consideration of such problems, so that the starting time for the image stream is set to be earlier than necessary by mistake.
This makes changes in virtual buffer occupancy incorrect, resulting in an initial value of the buffer occupancy for the following stream 1102 calculated incorrectly.
FIG. 5 is a pattern diagram illustrating incorrect buffer occupancy changes and correct buffer occupancy changes, respectively.
As illustrated in FIG. 5, in conventional techniques, a preceding stream 1101 and a following stream 1102 are assumed to be in a state illustrated by (i). Accordingly, an image stream included in the following stream 1102 starts at a starting time t1. Under the condition, an initial value of virtual buffer occupancy becomes S10 as a result of buffer simulation.
However, the starting time practically becomes later than the t1, as illustrated (ii), due to specific information 1203 and 1204 included in the preceding stream 1101 and the following stream 1102, respectively.
More specifically, the starting time becomes a t2 in the present example as illustrated in the diagram. Thus, the correct buffer occupancy changes with lower values than the incorrect buffer occupancy. Consequently, the initial value of the virtual buffer occupancy becomes S11.
In other words, the initial value of the virtual buffer occupancy according to the conventional technique becomes S10 that is a greater value than the correct value S11. Further, an amount of coded data of the first picture in the following stream 1102 is determined based on the S10.
In the case where the amount of coded data of the first picture is determined based on the incorrect initial value as described above, an underflow may occur at a time (t4) when the first picture is extracted from the virtual buffer.
In other words, with the above-described conventional technique, a stream which is not in consistent with the specification and may cause underflow in a decoding apparatus may be generated.
It is to be noted that a starting time for storing an image stream included in the following stream 1102 into the virtual buffer may also delays, even when the specific information is not included, due to only a time required for multiplexing between the preceding stream 1101 and the following stream 1102 as illustrated in (iii) of FIG. 4.